package ro.isdc.vms.utils.timestamp;

/**
 * Utility class for computing milliseconds
 *
 * @author Andrei Chirila
 */
public class TimeIntervalUtil {

  /**
   * Returns the seconds duration in milliseconds
   */
  public static long getSecondsInMilliseconds(final long seconds) {
    return seconds * 1000;
  }
  
  /**
   * Returns the minutes duration in milliseconds
   */
  public static long getMinutesInMilliseconds(final long minutes) { 
    return minutes * 60 * 1000;
  }
  
  /**
   * Returns the hours duration in milliseconds
   */
  public static long getHoursInMilliseconds(final long hours) {
    return hours *  3600 * 1000;
  }
  
  /**
   * Returns the days duration in milliseconds
   */
  public static long getDaysInMilliseconds(final long days) {
    return days * 24 * 3600 * 1000;
  }
  
  /**
   * Returns the number of seconds represented by a number of milliseconds.
   */
  public static int getMillisecondsInSeconds(final long milliseconds) {
    return (int) milliseconds /1000;
  }
  
  /**
   * Returns the number of minutes represented by a number of milliseconds.
   */
  public static int getMillisecondsInMinutes(final long milliseconds) {
    return (int) (milliseconds /1000 /60);
  }
  
  /**
   * Returns the number of hours represented by a number of milliseconds.
   */
  public static int getMillisecondsInHours(final long milliseconds) {
    return (int) (milliseconds /1000 /60 /60);
  }
  
  /**
   * Returns the number of days represented by a number of milliseconds.
   */
  public static int getMillisecondsInDays(final long milliseconds) {
    return (int) (milliseconds /1000 /60 /60 /24);
  }
}
